package com.vcredit.creditcat.service;

import com.vcredit.creditcat.model.CreditDimension;
import com.vcredit.creditcat.persistence.base.CreditDimensionMapper;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * 
 **/
@Service
public class CreditDimensionService {
	@Autowired
	private CreditDimensionMapper mapper;

	@CacheEvict(key = "'config:CreditDimensions'", value = "dimension")
	public void insert(CreditDimension obj) {
		mapper.insert(obj);
	}

	@CacheEvict(key = "'config:CreditDimensions'", value = "dimension")
	public void update(CreditDimension obj) {
		mapper.update(obj);
	}

	@Cacheable(key = "'config:CreditDimensions'", value = "dimension")
	public List<CreditDimension> findAll() {
		return mapper.findAll();
	}

	@SuppressWarnings("unused")
	private List<CreditDimension> find(CreditDimension obj) {
		return mapper.find(obj);
	}
}